fix(lint-mdx): handle multi-line <img> tags in alt-attribute check - #1793
Open
teyrebaz33 wants to merge 1 commit into
Open
fix(lint-mdx): handle multi-line <img> tags in alt-attribute check#1793teyrebaz33 wants to merge 1 commit into
teyrebaz33 wants to merge 1 commit into
Conversation
The alt-attribute check in checkMintlifyComponents only looked at the single line containing '<img', so when an <img> tag's attributes were spread across multiple lines (a common JSX formatting style used throughout docs/), a present alt= attribute on a later line was never seen and the linter reported a false-positive missing-alt warning. This affected 5 warnings across 3 files that already had a valid alt attribute: - docs/base-account/improve-ux/sponsor-gas/paymasters.mdx (2) - docs/base-account/reference/ui-elements/brand-guidelines.mdx (2) - docs/snippets/BasePayButton.mdx (1) The check now accumulates lines starting at the <img> tag until the tag closes (or end of file), matching the multi-line lookback pattern already used by the adjacent <Frame>-wrapping check in the same file. Verified with node scripts/lint-mdx.js all: warnings drop from 75 to 70 (exactly the 5 false positives), errors unchanged at 1246. Also verified against a synthetic missing-alt case and a synthetic multi-line-with-alt case to confirm the check still catches real violations and doesn't over-suppress.
Collaborator
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1792
Problem
The alt-attribute check in scripts/lint-mdx.js only looked at the single line containing <img, so when an
tag's attributes were spread across multiple lines, a present alt= attribute on a later line was never seen, producing a false-positive warning.
Fix
The check now accumulates lines starting at the
tag until the tag closes (or end of file) before checking for alt=, matching the multi-line lookback pattern already used by the adjacent Frame-wrapping check in the same function.
Verification